package com.hex.ds.hdrs.common.constant;

/**
 * @Package: com.hex.ds.hdrs.common.constant
 * @ClassName TaskStatusCode
 * @Description:任务状态枚举
 * @Author: <gc.zuo>
 * @Date 2022/2/10 15:06
 * @Version v1.0
 **/
public enum TaskStatusCode {

    one("1", "待执行"),
    two("2", "执行中"),
    three("3", "暂停"),
    four("4", "执行成功"),
    five("5", "执行失败"),
    six("6", "置虚"),
    ;

    public String getCode() {
        return code;
    }

    private void setCode(String code) {
        this.code = code;
    }

    public String getStatus() {
        return status;
    }

    private void setStatus(String status) {
        this.status = status;
    }

    private String code;
    private String status;

    private TaskStatusCode(String code, String status) {
        this.code = code;
        this.status = status;
    }

    public static String getStatus(String code) {
        TaskStatusCode[] errorCodes = values();
        for (TaskStatusCode errorCode : errorCodes) {
            if (errorCode.code.equals(code)) {
                return errorCode.status;
            }
        }
        return code;
    }
}
